﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BarChart;

namespace NutriFast
{
    public partial class DietaResumen : Form
    {
        public DietaResumen()
        {
            InitializeComponent();
        }




 
        private void DietaResumen_Load(object sender, EventArgs e)
        {

            llenarlista();
            


        }
        private void llenarlista() {
            DataTable dt = dbTavo.grupo();

            // Suspending automatic refreshes as items are added/removed.
            listAuthors.BeginUpdate();

            listAuthors.LargeImageList = imagesLarge;
            foreach (DataRow dr in dt.Rows)
            {

                ListViewItem listItem = new ListViewItem(dr["fName"].ToString());
                if (int.Parse(dr["fGroup"].ToString()) == 1) {
                listItem.ImageIndex = 0;
                }
                else{
                listItem.ImageIndex = 1;
                }
                
                // Add sub-items for Details view.
                listItem.SubItems.Add(dr["idFood"].ToString());
                listItem.SubItems.Add(dr["fGroup"].ToString());

                listAuthors.Items.Add(listItem);
            }

            // Add column headers for Details view.
            listAuthors.Columns.Add("Nombre", 100, HorizontalAlignment.Left);
            listAuthors.Columns.Add("ID", 100, HorizontalAlignment.Left);
            listAuthors.Columns.Add("Description", 100, HorizontalAlignment.Left);

            // Re-enable the display.
            listAuthors.EndUpdate();
        
        
        }

    }
}
